package com.ncloud.crm.mapper;

import org.apache.ibatis.annotations.*;

import com.ncloud.crm.entity.order.OrderContract;

import java.util.List;

/**
 * Created by shiqiang on 2017/4/11.
 */
@Mapper
public interface OrderContractMapper {
    @Select(value = { "select * from bs_o_contract where order_id = #{orderId}" })
    @Results({ @Result(column = "order_id", property = "orderId"), @Result(column = "modify_tag", property = "modifyTag"),
            @Result(column="contract_id",property="contractId"),@Result(column="contract_name",property="contractName"),
            @Result(column="cust_id",property="custId"),
            @Result(column="file_path",property="filePath"),@Result(column="sign_date",property="signDate"),@Result(column="exp_date",property="expDate"),
            @Result(column="eff_date",property="effDate"),@Result(column="sale_id",property="saleId"),@Result(column="create_time",property="createTime"),
            @Result(column="create_user",property="createUser"),@Result(column="update_time",property="updateTime"),
            @Result(column="update_user",property="updateUser")})
    public List<OrderContract> getContractByOrderId(Long orderId);
    @Insert(value = "insert into bs_o_contract(order_id,modify_tag,contract_id,contract_name,cust_id,file_path," +
            "sign_date,exp_date,eff_date,sale_id,create_time,create_user,update_time,update_user) " +
            "values(#{orderId},#{modifyTag},#{contractId},#{contractName},#{custId},#{filePath},#{signDate}," +
            "#{expDate},#{effDate},#{saleId},#{createTime},#{createUser},#{updateTime},#{updateUser})")
    public int insertOrderContract(OrderContract orderAttr);
}
